<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
     <a href="http://www.baidu.com">百度</a>
     <button onclick="forward()">前进</button>
     <button onclick="back()">后退</button>
     <button onclick="goto(-1)">后退go</button>
     <button onclick="goto(1)">前进go</button>
    <script>
        // history 允许我们访问浏览曾经的会话记录
        console.log(history);

        function forward(){
            history.forward()
        }

        function back(params) {
            history.back()
        }

        function goto(e) {
            // go：代表加载某一页  1是前进 -1后退
            history.go(e)
        }

        // console.log(history.length);
        

        
    </script>
</body>
</html>